import * as Monaco from 'monaco-editor/esm/vs/editor/editor.api'
// @ts-ignore
import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
// @ts-ignore
import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'

const self: any = window
self.MonacoEnvironment = {
	getWorker(_: string, label: string) {
		if (label === 'json') {
			return new JsonWorker()
		}
		return new EditorWorker()
	},
}
export default Monaco
